Selection subroutine
'
'
' ***** Selection *****
'
SUB Selection
  PRINT "Selection callback from kid #"; r0
END SUB

XuiDialog2B doesn't process callback messages internally because its Callback subroutine sends callback messages back to the function that set itself as the XuiDialog2B grid.

If you modify the Callback subroutine as described previously, however, #Selection callback messages will be sent to this subroutine.  Here you can add functionality code to process callback messages from the XuiDialog2B kid grids, and send #Selection and/or other callback messages back under appropriate circumstances.

As a simple example, if you made the described modifications to the Callback subroutine, the following code will convert this function into a simplified name input dialog.

First, add

  XuiSendMessage (g, #SetTextString, 0, 0, 0, 0, 0, @"Enter your name below")

to the Create subroutine after the line that creates the XuiLabel kid to tell the user what to do when the grid appears.

Second, fill the Selection subroutine with these lines:

SUB Selection
  SELECT CASE r0
    CASE $TextLine, $Button0
      XuiSendMessage (grid, #GetTextString, 0, 0, 0, 0, $TextLine, @name$)
      XuiSendMessage (grid, #SetTextString, 0, 0, 0, 0, 0, @name$)
      IF name$ THEN value = 0 ELSE value = -1
    CASE $Button1
      value = -1 ' 0 = ok : -1 = cancel
  END SELECT
  XuiCallback (grid, #Selection, value, 0, 0, 0, 0, 0)
END SUB